home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / ForCLI / ATT_awk_1_0.readme < prev    next >
Text File  |  1996-09-26  |  5KB  |  117 lines

  1. Short: Fully functional AT&T awk for all Amigas
  2. Type: util/cli
  3. Uploader: torsten@diku.dk (Torsten Poulin)
  4. Author: AT&T
  5.  
  6. Version 1.0 of a fully functional Amiga port of the April 22, 1994
  7. version of AT&T awk compiled with SAS/C 6.51.
  8. ------------------------------------------------------------------
  9.  
  10. The AT&T supplied code is 100% unchanged! The file "amiga.c" contains
  11. all the necessary adaptions to the AmigaDOS environment. 
  12.  
  13. I have run the "awk.g.y" and "awk.lx.l" files through yacc and lex
  14. respectively on an HP-UX workstation. The resulting C sources seem to
  15. build okay on the Amiga. The included smakefile does not attempt to
  16. recreate them. My advice is: do not delete "y.tab.c", "y.tab.h", and
  17. "lex.yy.c"!
  18.  
  19. To rebuild using SAS/C 6.51, just unpack the Amiga and AT&T source to
  20. the same directory and type smake.
  21.  
  22. Pipes are implemented in a very simplistic way. In fact they are not
  23. really pipes at all. Instead they are simulated using temporary files
  24. in the T: directory. This may change in the future, Matthew Dillon's
  25. FifoLib looks like a promising candidate.
  26.  
  27. The awk ENVIRON array holds copies of the local shell variables, but
  28. only under AmigaDOS 2.04+. Yes, awk should work with all versions of
  29. AmigaDOS.
  30.  
  31. Command line arguments are treated a bit differently than with most
  32. Amiga programs. Both the usual " as well as ' can be used to quote
  33. arguments:
  34.  
  35.   awk "BEGIN { *"date*" |getline d; print d }"
  36.   awk 'BEGIN { "date" |getline d; print d }'
  37.  
  38. Personally I tend to prefer the latter form, as it resembles the
  39. examples in A.V.Aho et al. "The AWK Programming Language". The escape
  40. character is the asterisk usually used in AmigaDOS. I tried using a
  41. backslash, but at least with WShell it caused more trouble than it is
  42. worth, because WShell (by necessity) tries to be clever about the
  43. contents of the command line.
  44.  
  45. Liberal use of escapes may be necessary when using single quotes,
  46. depending on which shell you use, e.g.,
  47.  
  48.   awk 'BEGIN { "date" *|getline d *; print d }'
  49.  
  50. The blanks before the asterisks are significant in WShell. If you
  51. don't want to bother with all these pitfalls, you can of course always
  52. put your script in a file and use the -f option...
  53.  
  54. Arguments are treated like AmigaDOS patterns, and expanded, if
  55.  
  56.   (1) they are not surrounded by single or double
  57.       quotes, and
  58.   (2) they contain at least one of the eight
  59.       characters "~#?*%([|", and
  60.   (3) awk is run under AmigaDOS V36+ OR arp.library
  61.       is installed.
  62.  
  63. The program works with pre-V36 AmigaDOS even if arp.library isn't
  64. installed, but it will not expand patterns. It will not attempt to
  65. open arp.library if running under V36+.
  66.  
  67. This example prints the total number of characters, words, and lines
  68. in the files in the current directory:
  69.  
  70.   awk "{ nc+=length($0)+1; nw+=NF} END { print nc, nw, NR }" #?.txt
  71.  
  72. With a little extra work, it can be turned into a clone of the UNIX wc
  73. command :-)
  74.  
  75. A word of warning. If an AmigaDOS pattern doesn't match any filenames,
  76. it expands to nothing, possibly causing an awk script to seem like
  77. it is hanging, while it is in fact just waiting for input from stdin.
  78. In that case you can just press Ctrl-\ (end of file).
  79.  
  80. Before I forget it, awk is pure and can be made resident.
  81.  
  82. Comments, questions and bug reports concerning this port can be sent
  83. to me at the following address:
  84.  
  85.    Torsten Poulin
  86.    Banebrinken 99, 2, 77
  87.    DK-2400 København NV
  88.    Denmark
  89.  
  90. or via e-mail: torsten@diku.dk (preferred)
  91.  
  92. Please note that my snail-mail address will change sometime this
  93. autumn. The Danish Mail will forward any letters to me for half a year
  94. after that, though.
  95.  
  96. Have fun,
  97. Torsten
  98.  
  99. P.S. awk is copyrighted by AT&T. Please refer to the copyright notices
  100. in the source and documentation files for details.
  101.  
  102.  
  103. ============================= Archive contents =============================
  104.  
  105. Original  Packed Ratio    Date     Time    Name
  106. -------- ------- ----- --------- --------  -------------
  107.    30497   30497  0.0% 04-Jun-94 15:24:16  AT&T-awk/Amigasrc.lha
  108.    58088   58088  0.0% 04-Jun-94 15:22:04  AT&T-awk/AT&Tsrc.lha
  109.   114040   52147 54.2% 04-Jun-94 14:44:32  AT&T-awk/awk
  110.     9653    3921 59.3% 11-May-94 23:11:06  AT&T-awk/awk.1
  111.    13281    4511 66.0% 02-Jun-94 12:24:24  AT&T-awk/awk.man
  112.    11942    5516 53.8% 11-May-94 23:11:02  AT&T-awk/FIXES
  113.     2723    1418 47.9% 11-May-94 23:11:02  AT&T-awk/README
  114.     3623    1864 48.5% 04-Jun-94 15:20:42  AT&T-awk/ReadMe.amiga
  115. -------- ------- ----- --------- --------
  116.   243847  157962 35.2% 05-Jun-94 14:37:20   8 files
  117.